
<?php 
	if(!isset($base)){
		include 'db.php';
		$base = new BazaDanych();
	}
	
	if(isset($_COOKIE['Login']) && $_COOKIE["Login"]==true){
	?>
	
<span class="link" onclick="getAddEntry()">+ Dodaj wpis</span>
<?php 
	}
	if(isset($_GET['edit'])) include 'entry.php';
?>
<table class="blog">
<tr>
	<td><br/>Wpisy<br/><br/></td>
</tr>
<?php 	

	

	$wyniki = $base->pobierzTabliceWynikow("select * from entry");

	foreach ($wyniki as $wpis){
		echo "<tr><td class=\"black\">";
		echo $wpis["TITLE"];
		if(isset($_COOKIE['Login']) && $_COOKIE["Login"]==true) echo "&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"link\" onclick=\"getEditEntry(".$wpis['ID'].")\">[Edytuj]</a>";
		echo "</td></tr>";
		echo "<tr><td class=\"down\">";
		echo $wpis["DESCRIPTION"];
		echo "</td></tr>";
		echo "<tr><td class=\"blank\">";
		echo "&nbsp;";
		echo "</td></tr>";
	}
?>
</table>